/**
 * Panel chinh cua game
 * Su dung cardlayout de dieu khien qua lai giua cac panel con
 */
package view;

import java.awt.*;
import javax.swing.*;

public class MainPanel extends JPanel {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private final int PANEL_WIDTH = 900;
	private final int PANEL_HEIGHT = 680;
	
	// thuoc tinh
	private CardLayout card = new CardLayout(0, 0);
	
	private HomePanel menuHome;
	private PlayPanel playPanel;
	private LoginPanel loginPanel;
	private UserHomePanel userHomePanel;
	private ConfigPanel configPanel;
	private MainFrame mainFrame;
	private HighScorePanel highScorePanel;
	private AboutPanel aboutPanel;
	private HelpPanel helpPanel;

	// constructor
	public MainPanel() {
		setPreferredSize(new Dimension(PANEL_WIDTH, PANEL_HEIGHT));
		setLayout(card);
		
		menuHome = new HomePanel(this);
		this.add(menuHome, HomePanel.KEY);
		
		playPanel = new PlayPanel(this);
		this.add(playPanel, PlayPanel.KEY);
		
		loginPanel = new LoginPanel(this);
		this.add(loginPanel, LoginPanel.KEY);
		
		userHomePanel = new UserHomePanel(this);
		this.add(userHomePanel, UserHomePanel.KEY);
		
		configPanel = new ConfigPanel(this);
		this.add(configPanel, ConfigPanel.KEY);
		
		highScorePanel = new HighScorePanel(this);
		this.add(highScorePanel, HighScorePanel.KEY);
		
		aboutPanel = new AboutPanel(this);
		this.add(aboutPanel, AboutPanel.KEY);
		
		helpPanel = new HelpPanel(this);
		this.add(helpPanel, HelpPanel.KEY);
		
	}
	
	public void switchPanel(String key) {
		this.card.show(this, key);
	}

	/**
	 * @return the userHomePanel
	 */
	public UserHomePanel getUserHomePanel() {
		return userHomePanel;
	}

	/**
	 * @return the playPanel
	 */
	public PlayPanel getPlayPanel() {
		return playPanel;
	}

	/**
	 * @return the highScorePanel
	 */
	public HighScorePanel getHighScorePanel() {
		return highScorePanel;
	}

	/**
	 * @return the mainFrame
	 */
	public MainFrame getMainFrame() {
		return mainFrame;
	}

	/**
	 * @param mainFrame the mainFrame to set
	 */
	public void setMainFrame(MainFrame mainFrame) {
		this.mainFrame = mainFrame;
	}
}
